<?php

namespace App\Dao\Product;

use Yj\Daos\BaseDaos;
use App\Model\Product\StoreProductAttr;
use Hyperf\Database\Model\Builder;
use Yj\Daos\Verify;
use Hyperf\Utils\Collection;

/**
 * @var StoreProductAttr
 * @method $this params($params)
 */
class StoreProductAttrDao extends BaseDaos
{
    public function searchParams(Collection $params)
    {
        $search = $this->getSearch();
        return $search;
    }

    public function lists(Collection $params)
    {
        
        $data = $this->params($params)->orderByDesc("id")->getList();
        return $data;
        
    }

    public function add(Collection $params)
    {
        
        $data = $this->create($params->toArray());
        return $data;
        
    }

    public function del(int $id)
    {
        
        $data = $this->DaoWhere(["id"=>$id])->firstOrError();
        return $data->delete();
        
    }
}
